window: maximize on double click only if allowed
authorOlivier Fourdan <ofourdan@redhat.com>
Wed, 4 Nov 2015 10:24:36 +0000 (11:24 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 19 Nov 2015 20:04:03 +0000 (15:04 -0500)
GtkHeaderBar will not show the maximize button if the window in not of
type normal or not resizeable.

Use the same restriction for double-click actions as well.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=757530

gtk/gtkwindow.c

index 7b05341b151a2777ca823e8da1eb49d05710e311..f87acd9b60380eb415fcda23218473613424155c 100644 (file)
@@ -1383,7 +1383,16 @@ gtk_window_titlebar_action (GtkWindow      *window,
     retval = FALSE;
     /* treat all maximization variants the same */
   else if (g_str_has_prefix (action, "toggle-maximize"))
-    _gtk_window_toggle_maximized (window);
+    {
+      /*
+       * gtk header bar won't show the maximize button if the following
+       * properties are not met, apply the same to title bar actions for
+       * consistency.
+       */
+      if (gtk_window_get_resizable (window) &&
+          gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL)
+            _gtk_window_toggle_maximized (window);
+    }
   else if (g_str_equal (action, "lower"))
     gdk_window_lower (_gtk_widget_get_window (GTK_WIDGET (window)));
   else if (g_str_equal (action, "minimize"))